Repository navigation
fix(github-backup): validate last_fetch shape in validate_state (#6821) - #8686
Conversation
A wrong-shape per-repo last_fetch (string/list/dict/bool) passed #6637 validation and crashed fetch_mirrors.main at the coalesce check, wedging the whole daily fetch. validate_state now drops a non-numeric last_fetch under a named problem (drain bookkeeping entries keep their own shapes), so the repo is fetched normally and the loop, state rewrite, and manifest regeneration all complete. Regression tests: unit shapes + numeric control in test_plan_state_shape.py (property oracle updated), full-loop test in test_fetch_mirrors.py. Full github-backup suite green.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #6821.
Problem
validate_state(#6637) checked per-repo entry shape,fail_days, and thedrain_*bookkeeping keys, but not the per-repolast_fetchfield — the one fieldfetch_mirrors.maindoes arithmetic on at the coalesce check. A string/list/dictlast_fetch(hand edit, older/newer writer, torn write per #3240) passed validation silently and raised TypeError inside the repo loop, so no repo was fetched, state.json was never rewritten, and MANIFEST regeneration never ran. A boollast_fetchsilently read as epoch 1.Fix
ghb_common.validate_state: a per-repolast_fetchthat is present and not an int/float (bools excluded, matching thedrain_last::rule) is dropped under a named problem, visible viareport_problems. The repo is then treated as never-fetched and fetched normally. Drain bookkeeping entries (drain_*) keep their own shapes and are not last_fetch-validated — their inner fields are preserved verbatim. Numeric behavior is unchanged exactly: fresh entries coalesce-skip (<12h), stale entries fetch.Tests
Oracle: the #6821 acceptance criteria — a wrong-shape last_fetch produces a named problem and never reaches the fetch loop as a non-number; the full loop completes.
test_plan_state_shape.py: string/list/dict/bool shapes named + dropped, numeric control (int/float/0) passes unchanged, drain_fail inner fields preserved; the property-test state oracle now encodes the same invariant.test_fetch_mirrors.py: full-loop test — poisoned repo fetched, fresh repo coalesce-skips, state.json rewritten with numeric last_fetch, manifest build called once, problem named on stderr.infra/github-backup/tests/suite green (all 13 files).Queue task 11045, lane code-c.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.